home *** CD-ROM | disk | FTP | other *** search
/ Windows Game Programming for Dummies (2nd Edition) / WinGamProgFD.iso / mac / DirectX SDK / DXSDK / include / dpaddr.h < prev    next >
C/C++ Source or Header  |  2001-10-16  |  16KB  |  376 lines

  1. /*==========================================================================;
  2.  *
  3.  *  Copyright (C) 2000 Microsoft Corporation.  All Rights Reserved.
  4.  *
  5.  *  File:       dpaddr.h
  6.  *  Content:   DirectPlayAddress include file
  7.  ***************************************************************************/
  8.  
  9. #ifndef __DIRECTPLAYADDRESS__
  10. #define __DIRECTPLAYADDRESS__
  11.  
  12. #include <ole2.h>            // for DECLARE_INTERFACE and HRESULT
  13.  
  14. #ifdef __cplusplus
  15. extern "C" {
  16. #endif
  17.  
  18. #include "dplay8.h"
  19.  
  20. /****************************************************************************
  21.  *
  22.  * DirectPlay8Address CLSIDs
  23.  *
  24.  ****************************************************************************/
  25.  
  26. // {934A9523-A3CA-4bc5-ADA0-D6D95D979421}
  27. DEFINE_GUID(CLSID_DirectPlay8Address,
  28. 0x934a9523, 0xa3ca, 0x4bc5, 0xad, 0xa0, 0xd6, 0xd9, 0x5d, 0x97, 0x94, 0x21);
  29.  
  30. /****************************************************************************
  31.  *
  32.  * DirectPlay8Address Interface IIDs
  33.  *
  34.  ****************************************************************************/
  35.  
  36.  
  37. // {83783300-4063-4c8a-9DB3-82830A7FEB31}
  38. DEFINE_GUID(IID_IDirectPlay8Address,
  39. 0x83783300, 0x4063, 0x4c8a, 0x9d, 0xb3, 0x82, 0x83, 0xa, 0x7f, 0xeb, 0x31);
  40.  
  41. // {E5A0E990-2BAD-430b-87DA-A142CF75DE58}
  42. DEFINE_GUID(IID_IDirectPlay8AddressIP,
  43. 0xe5a0e990, 0x2bad, 0x430b, 0x87, 0xda, 0xa1, 0x42, 0xcf, 0x75, 0xde, 0x58);
  44.  
  45.  
  46. /****************************************************************************
  47.  *
  48.  * DirectPlay8Address Interface Pointer definitions
  49.  *
  50.  ****************************************************************************/
  51.  
  52.  
  53. typedef struct IDirectPlay8Address            *PDIRECTPLAY8ADDRESS, *LPDIRECTPLAY8ADDRESS;
  54. typedef struct IDirectPlay8AddressIP        *PDIRECTPLAY8ADDRESSIP, *LPDIRECTPLAY8ADDRESSIP;
  55.  
  56. /****************************************************************************
  57.  *
  58.  * DirectPlay8Address Forward Declarations For External Types
  59.  *
  60.  ****************************************************************************/
  61.  
  62. typedef struct sockaddr SOCKADDR;
  63.  
  64. /****************************************************************************
  65.  *
  66.  * DirectPlay8Address Constants
  67.  *
  68.  ****************************************************************************/
  69. //
  70. // Asynchronous operation flags
  71. //
  72. #define DPNA_DATATYPE_STRING                0x00000001
  73. #define DPNA_DATATYPE_DWORD                    0x00000002
  74. #define DPNA_DATATYPE_GUID                    0x00000003
  75. #define DPNA_DATATYPE_BINARY                0x00000004
  76. #define DPNA_DATATYPE_STRING_ANSI           0x00000005
  77.  
  78. #define DPNA_DPNSVR_PORT                    6073
  79.  
  80. #define DPNA_INDEX_INVALID                    0xFFFFFFFF
  81.  
  82. /****************************************************************************
  83.  *
  84.  * DirectPlay8Address Address Elements
  85.  *
  86.  ****************************************************************************/
  87.  
  88. #define DPNA_SEPARATOR_KEYVALUE                L'='
  89. #define DPNA_SEPARATOR_USERDATA                L'#'
  90. #define DPNA_SEPARATOR_COMPONENT            L';'
  91. #define DPNA_ESCAPECHAR                        L'%'
  92.  
  93. // Header
  94. #define DPNA_HEADER                            L"x-directplay:/"
  95.  
  96. // key names for address components
  97. #define DPNA_KEY_APPLICATION_INSTANCE        L"applicationinstance"
  98. #define DPNA_KEY_BAUD                        L"baud"
  99. #define DPNA_KEY_DEVICE                        L"device"
  100. #define DPNA_KEY_FLOWCONTROL                L"flowcontrol"
  101. #define DPNA_KEY_HOSTNAME                    L"hostname"
  102. #define DPNA_KEY_PARITY                        L"parity"
  103. #define DPNA_KEY_PHONENUMBER                L"phonenumber"
  104. #define DPNA_KEY_PORT                        L"port"
  105. #define DPNA_KEY_PROGRAM                    L"program"
  106. #define DPNA_KEY_PROVIDER                    L"provider"
  107. #define DPNA_KEY_STOPBITS                    L"stopbits"
  108.  
  109. // values for baud rate
  110. #define DPNA_BAUD_RATE_9600                    9600
  111. #define DPNA_BAUD_RATE_14400                14400
  112. #define DPNA_BAUD_RATE_19200                19200
  113. #define DPNA_BAUD_RATE_38400                38400
  114. #define DPNA_BAUD_RATE_56000                56000
  115. #define DPNA_BAUD_RATE_57600                57600
  116. #define DPNA_BAUD_RATE_115200                115200
  117.  
  118. // values for stop bits
  119. #define DPNA_STOP_BITS_ONE                    L"1"
  120. #define DPNA_STOP_BITS_ONE_FIVE                L"1.5"
  121. #define DPNA_STOP_BITS_TWO                    L"2"
  122.  
  123. // values for parity
  124. #define DPNA_PARITY_NONE                    L"NONE"
  125. #define DPNA_PARITY_EVEN                    L"EVEN"
  126. #define DPNA_PARITY_ODD                        L"ODD"
  127. #define DPNA_PARITY_MARK                    L"MARK"
  128. #define DPNA_PARITY_SPACE                    L"SPACE"
  129.  
  130. // values for flow control
  131. #define DPNA_FLOW_CONTROL_NONE                L"NONE"
  132. #define DPNA_FLOW_CONTROL_XONXOFF            L"XONXOFF"
  133. #define DPNA_FLOW_CONTROL_RTS                L"RTS"
  134. #define DPNA_FLOW_CONTROL_DTR                L"DTR"
  135. #define DPNA_FLOW_CONTROL_RTSDTR            L"RTSDTR"
  136.  
  137. // Shortcut values
  138. //
  139. // These can be used instead of the corresponding CLSID_DP8SP_XXXX guids
  140. //
  141. #define DPNA_VALUE_TCPIPPROVIDER            L"IP"
  142. #define DPNA_VALUE_IPXPROVIDER              L"IPX"
  143. #define DPNA_VALUE_MODEMPROVIDER            L"MODEM"
  144. #define DPNA_VALUE_SERIALPROVIDER           L"SERIAL"
  145.  
  146.  
  147. //// ANSI DEFINITIONS
  148.  
  149. // Header
  150. #define DPNA_HEADER_A                        "x-directplay:/"
  151. #define DPNA_SEPARATOR_KEYVALUE_A            '='
  152. #define DPNA_SEPARATOR_USERDATA_A            '#'
  153. #define DPNA_SEPARATOR_COMPONENT_A            ';'
  154. #define DPNA_ESCAPECHAR_A                    '%'
  155.  
  156. // key names for address components
  157. #define DPNA_KEY_APPLICATION_INSTANCE_A        "applicationinstance"
  158. #define DPNA_KEY_BAUD_A                        "baud"
  159. #define DPNA_KEY_DEVICE_A                    "device"
  160. #define DPNA_KEY_FLOWCONTROL_A                "flowcontrol"
  161. #define DPNA_KEY_HOSTNAME_A                    "hostname"
  162. #define DPNA_KEY_PARITY_A                    "parity"
  163. #define DPNA_KEY_PHONENUMBER_A                "phonenumber"
  164. #define DPNA_KEY_PORT_A                        "port"
  165. #define DPNA_KEY_PROGRAM_A                    "program"
  166. #define DPNA_KEY_PROVIDER_A                    "provider"
  167. #define DPNA_KEY_STOPBITS_A                    "stopbits"
  168.  
  169. // values for stop bits
  170. #define DPNA_STOP_BITS_ONE_A                "1"
  171. #define DPNA_STOP_BITS_ONE_FIVE_A            "1.5"
  172. #define DPNA_STOP_BITS_TWO_A                "2"
  173.  
  174. // values for parity
  175. #define DPNA_PARITY_NONE_A                    "NONE"
  176. #define DPNA_PARITY_EVEN_A                    "EVEN"
  177. #define DPNA_PARITY_ODD_A                    "ODD"
  178. #define DPNA_PARITY_MARK_A                    "MARK"
  179. #define DPNA_PARITY_SPACE_A                    "SPACE"
  180.  
  181. // values for flow control
  182. #define DPNA_FLOW_CONTROL_NONE_A            "NONE"
  183. #define DPNA_FLOW_CONTROL_XONXOFF_A         "XONXOFF"
  184. #define DPNA_FLOW_CONTROL_RTS_A                "RTS"
  185. #define DPNA_FLOW_CONTROL_DTR_A                "DTR"
  186. #define DPNA_FLOW_CONTROL_RTSDTR_A            "RTSDTR"
  187.  
  188. // Shortcut values
  189. //
  190. // These can be used instead of the corresponding CLSID_DP8SP_XXXX guids
  191. //
  192. #define DPNA_VALUE_TCPIPPROVIDER_A          "IP"
  193. #define DPNA_VALUE_IPXPROVIDER_A            "IPX"
  194. #define DPNA_VALUE_MODEMPROVIDER_A          "MODEM"
  195. #define DPNA_VALUE_SERIALPROVIDER_A         "SERIAL"
  196.  
  197. /****************************************************************************
  198.  *
  199.  * DirectPlay8Address Functions
  200.  *
  201.  ****************************************************************************/
  202.  
  203. /*
  204.  * 
  205.  * This function is no longer supported.  It is recommended that CoCreateInstance be used to create 
  206.  * DirectPlay8 address objects. 
  207.  *
  208.  * HRESULT WINAPI DirectPlay8AddressCreate( const GUID * pcIID, void **ppvInterface, IUnknown *pUnknown);
  209.  *
  210.  */
  211.  
  212. /****************************************************************************
  213.  *
  214.  * DirectPlay8Address Application Interfaces
  215.  *
  216.  ****************************************************************************/
  217.  
  218. //
  219. // COM definition for IDirectPlay8Address Generic Interface
  220. //
  221. #undef INTERFACE                // External COM Implementation
  222. #define INTERFACE IDirectPlay8Address
  223. DECLARE_INTERFACE_(IDirectPlay8Address,IUnknown)
  224. {
  225.     /*** IUnknown methods ***/
  226.     STDMETHOD(QueryInterface)            (THIS_ REFIID, LPVOID *) PURE;
  227.     STDMETHOD_(ULONG,AddRef)            (THIS) PURE;
  228.     STDMETHOD_(ULONG,Release)            (THIS) PURE;
  229.     /*** IDirectPlay8Address methods ***/
  230.  
  231.     STDMETHOD(BuildFromURLW)(THIS_ WCHAR *pwszSourceURL ) PURE;
  232.     STDMETHOD(BuildFromURLA)(THIS_ CHAR *pszSourceURL ) PURE;
  233.     STDMETHOD(Duplicate)(THIS_ PDIRECTPLAY8ADDRESS *ppdpaNewAddress ) PURE;
  234.     STDMETHOD(SetEqual)(THIS_ PDIRECTPLAY8ADDRESS pdpaAddress ) PURE;
  235.     STDMETHOD(IsEqual)(THIS_ PDIRECTPLAY8ADDRESS pdpaAddress ) PURE;
  236.     STDMETHOD(Clear)(THIS ) PURE;
  237.     STDMETHOD(GetURLW)(THIS_ WCHAR *pwszURL, PDWORD pdwNumChars ) PURE;
  238.     STDMETHOD(GetURLA)(THIS_ CHAR *pszURL, PDWORD pdwNumChars) PURE;
  239.     STDMETHOD(GetSP)(THIS_ GUID *pguidSP ) PURE;
  240.     STDMETHOD(GetUserData)(THIS_ void *pvUserData, PDWORD pdwBufferSize) PURE;
  241.     STDMETHOD(SetSP)(THIS_ const GUID * const pguidSP ) PURE;
  242.     STDMETHOD(SetUserData)(THIS_ const void * const pvUserData, const DWORD dwDataSize) PURE;
  243.     STDMETHOD(GetNumComponents)(THIS_ PDWORD pdwNumComponents ) PURE;
  244.     STDMETHOD(GetComponentByName)(THIS_ const WCHAR * const pwszName, void *pvBuffer, PDWORD pdwBufferSize, PDWORD pdwDataType ) PURE;
  245.     STDMETHOD(GetComponentByIndex)(THIS_ const DWORD dwComponentID, WCHAR * pwszName, PDWORD pdwNameLen, void *pvBuffer, PDWORD pdwBufferSize, PDWORD pdwDataType ) PURE;
  246.     STDMETHOD(AddComponent)(THIS_ const WCHAR * const pwszName, const void * const lpvData, const DWORD dwDataSize, const DWORD dwDataType ) PURE;    
  247.     STDMETHOD(GetDevice)(THIS_  GUID * ) PURE;
  248.     STDMETHOD(SetDevice)(THIS_  const GUID * const) PURE;
  249.     STDMETHOD(BuildFromDPADDRESS)( THIS_ LPVOID pvAddress, DWORD dwDataSize ) PURE;
  250. };
  251.  
  252. //
  253. // COM definition for IDirectPlay8AddressIP Generic Interface
  254. //
  255. #undef INTERFACE                // External COM Implementation
  256. #define INTERFACE IDirectPlay8AddressIP
  257. DECLARE_INTERFACE_(IDirectPlay8AddressIP,IUnknown)
  258. {
  259.     /*** IUnknown methods ***/
  260.     STDMETHOD(QueryInterface)            (THIS_ REFIID, PVOID *) PURE;
  261.     STDMETHOD_(ULONG,AddRef)            (THIS) PURE;
  262.     STDMETHOD_(ULONG,Release)            (THIS) PURE;
  263.  
  264.     /*** IDirectPlay8AddressIP methods ***/
  265.  
  266.     // Constructs a IDirectPlay8 TCP Address from a SOCKADDR structure
  267.     STDMETHOD(BuildFromSockAddr)(THIS_ const SOCKADDR * const ) PURE;
  268.  
  269.     // Constructs a TCP Address from a string (hostname) and port
  270.     STDMETHOD(BuildAddress)(THIS_ const WCHAR * const wszAddress, const USHORT usPort ) PURE;
  271.  
  272.     // Builds a local TCP Address
  273.     STDMETHOD(BuildLocalAddress)(THIS_ const GUID * const pguidAdapter, const USHORT usPort ) PURE;
  274.  
  275.     // Gets the address from the structure in SOCKADR format
  276.     STDMETHOD(GetSockAddress)(THIS_ SOCKADDR *, PDWORD ) PURE;
  277.  
  278.     // Gets the local afddress
  279.     STDMETHOD(GetLocalAddress)(THIS_ GUID *pguidAdapter, USHORT *pusPort ) PURE;
  280.  
  281.     // Gets the remote address
  282.     STDMETHOD(GetAddress)(THIS_ WCHAR *wszAddress, PDWORD pdwAddressLength, USHORT *psPort ) PURE;
  283.  
  284. };
  285.  
  286.  
  287.  
  288. /****************************************************************************
  289.  *
  290.  * IDirectPlay8 application interface macros
  291.  *
  292.  ****************************************************************************/
  293.  
  294. #if !defined(__cplusplus) || defined(CINTERFACE)
  295.  
  296. #define IDirectPlay8Address_QueryInterface(p,a,b)            (p)->lpVtbl->QueryInterface(p,a,b)
  297. #define IDirectPlay8Address_AddRef(p)                          (p)->lpVtbl->AddRef(p)
  298. #define IDirectPlay8Address_Release(p)                         (p)->lpVtbl->Release(p)
  299. #define IDirectPlay8Address_BuildFromURLW(p,a)                (p)->lpVtbl->BuildFromURLW(p,a)
  300. #define IDirectPlay8Address_BuildFromURLA(p,a)                (p)->lpVtbl->BuildFromURLA(p,a)
  301. #define IDirectPlay8Address_Duplicate(p,a)                    (p)->lpVtbl->Duplicate(p,a)
  302. #define IDirectPlay8Address_SetEqual(p,a)                   (p)->lpVtbl->SetEqual(p,a)
  303. #define IDirectPlay8Address_IsEqual(p,a)                    (p)->lpVtbl->IsEqual(p,a)
  304. #define IDirectPlay8Address_Clear(p)                        (p)->lpVtbl->Clear(p)
  305. #define IDirectPlay8Address_GetURLW(p,a,b)                    (p)->lpVtbl->GetURLW(p,a,b)
  306. #define IDirectPlay8Address_GetURLA(p,a,b)                    (p)->lpVtbl->GetURLA(p,a,b)
  307. #define IDirectPlay8Address_GetSP(p,a)                        (p)->lpVtbl->GetSP(p,a)
  308. #define IDirectPlay8Address_GetUserData(p,a,b)                (p)->lpVtbl->GetUserData(p,a,b)
  309. #define IDirectPlay8Address_SetSP(p,a)                        (p)->lpVtbl->SetSP(p,a)
  310. #define IDirectPlay8Address_SetUserData(p,a,b)                (p)->lpVtbl->SetUserData(p,a,b)
  311. #define IDirectPlay8Address_GetNumComponents(p,a)            (p)->lpVtbl->GetNumComponents(p,a)
  312. #define IDirectPlay8Address_GetComponentByName(p,a,b,c,d)    (p)->lpVtbl->GetComponentByName(p,a,b,c,d)
  313. #define IDirectPlay8Address_GetComponentByIndex(p,a,b,c,d,e,f)    (p)->lpVtbl->GetComponentByIndex(p,a,b,c,d,e,f)
  314. #define IDirectPlay8Address_AddComponent(p,a,b,c,d)            (p)->lpVtbl->AddComponent(p,a,b,c,d)
  315. #define IDirectPlay8Address_SetDevice(p,a)                    (p)->lpVtbl->SetDevice(p,a)
  316. #define IDirectPlay8Address_GetDevice(p,a)                    (p)->lpVtbl->GetDevice(p,a)
  317. #define IDirectPlay8Address_BuildFromDirectPlay4Address(p,a,b)  (p)->lpVtbl->BuildFromDirectPlay4Address(p,a,b)
  318.  
  319. #define IDirectPlay8AddressIP_QueryInterface(p,a,b)            (p)->lpVtbl->QueryInterface(p,a,b)
  320. #define IDirectPlay8AddressIP_AddRef(p)                      (p)->lpVtbl->AddRef(p)
  321. #define IDirectPlay8AddressIP_Release(p)                     (p)->lpVtbl->Release(p)
  322. #define IDirectPlay8AddressIP_BuildFromSockAddr(p,a)        (p)->lpVtbl->BuildFromSockAddr(p,a)
  323. #define IDirectPlay8AddressIP_BuildAddress(p,a,b)            (p)->lpVtbl->BuildAddress(p,a,b)
  324. #define IDirectPlay8AddressIP_BuildLocalAddress(p,a,b)        (p)->lpVtbl->BuildLocalAddress(p,a,b)
  325. #define IDirectPlay8AddressIP_GetSockAddress(p,a,b)            (p)->lpVtbl->GetSockAddress(p,a,b)
  326. #define IDirectPlay8AddressIP_GetLocalAddress(p,a,b)        (p)->lpVtbl->GetLocalAddress(p,a,b)
  327. #define IDirectPlay8AddressIP_GetAddress(p,a,b,c)            (p)->lpVtbl->GetAddress(p,a,b,c)
  328.  
  329.  
  330. #else /* C++ */
  331.  
  332. #define IDirectPlay8Address_QueryInterface(p,a,b)            (p)->QueryInterface(a,b)
  333. #define IDirectPlay8Address_AddRef(p)                          (p)->AddRef()
  334. #define IDirectPlay8Address_Release(p)                         (p)->Release()
  335. #define IDirectPlay8Address_BuildFromURLW(p,a)                (p)->BuildFromURLW(a)
  336. #define IDirectPlay8Address_BuildFromURLA(p,a)                (p)->BuildFromURLA(a)
  337. #define IDirectPlay8Address_Duplicate(p,a)                    (p)->Duplicate(a)
  338. #define IDirectPlay8Address_SetEqual(p,a)                   (p)->SetEqual(a)
  339. #define IDirectPlay8Address_IsEqual(p,a)                    (p)->IsEqual(a)
  340. #define IDirectPlay8Address_Clear(p)                        (p)->Clear()
  341. #define IDirectPlay8Address_GetURLW(p,a,b)                    (p)->GetURLW(a,b)
  342. #define IDirectPlay8Address_GetURLA(p,a,b)                    (p)->GetURLA(a,b)
  343. #define IDirectPlay8Address_GetSP(p,a)                        (p)->GetSP(a)
  344. #define IDirectPlay8Address_GetUserData(p,a,b)                (p)->GetUserData(a,b)
  345. #define IDirectPlay8Address_SetSP(p,a)                        (p)->SetSP(a)
  346. #define IDirectPlay8Address_SetUserData(p,a,b)                (p)->SetUserData(a,b)
  347. #define IDirectPlay8Address_GetNumComponents(p,a)            (p)->GetNumComponents(a)
  348. #define IDirectPlay8Address_GetComponentByName(p,a,b,c,d)    (p)->GetComponentByName(a,b,c,d)
  349. #define IDirectPlay8Address_GetComponentByIndex(p,a,b,c,d,e,f)    (p)->GetComponentByIndex(a,b,c,d,e,f)
  350. #define IDirectPlay8Address_AddComponent(p,a,b,c,d)            (p)->AddComponent(a,b,c,d)
  351. #define IDirectPlay8Address_SetDevice(p,a)                    (p)->SetDevice(a)
  352. #define IDirectPlay8Address_GetDevice(p,a)                    (p)->GetDevice(a)
  353. #define IDirectPlay8Address_BuildFromDirectPlay4Address(p,a,b)  (p)->BuildFromDirectPlay4Address(a,b)
  354.  
  355. #define IDirectPlay8AddressIP_QueryInterface(p,a,b)            (p)->QueryInterface(a,b)
  356. #define IDirectPlay8AddressIP_AddRef(p)                      (p)->AddRef()
  357. #define IDirectPlay8AddressIP_Release(p)                     (p)->Release()
  358. #define IDirectPlay8AddressIP_BuildFromSockAddr(p,a)        (p)->BuildFromSockAddr(a)
  359. #define IDirectPlay8AddressIP_BuildAddress(p,a,b)            (p)->BuildAddress(a,b)
  360. #define IDirectPlay8AddressIP_BuildLocalAddress(p,a,b)        (p)->BuildLocalAddress(a,b)
  361. #define IDirectPlay8AddressIP_GetSockAddress(p,a,b)            (p)->GetSockAddress(a,b)
  362. #define IDirectPlay8AddressIP_GetLocalAddress(p,a,b)        (p)->GetLocalAddress(a,b)
  363. #define IDirectPlay8AddressIP_GetAddress(p,a,b,c)            (p)->GetAddress(a,b,c)
  364.  
  365.  
  366. #endif
  367.  
  368.  
  369. #ifdef __cplusplus
  370. }
  371. #endif
  372.  
  373. #endif
  374.  
  375.  
  376.